cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 17)
project(demo)
list(APPEND INCLUDE_DIR
    # ${PROJECT_SOURCE_DIR}/../_/thirdparty
    # ${PROJECT_SOURCE_DIR}/../_/thirdparty/rpc-backend-cpp
    # ${PROJECT_SOURCE_DIR}/../_/sdk_framework
    # ${PROJECT_SOURCE_DIR}/../package/include
    # ${PROJECT_SOURCE_DIR}/../package/include/struct/GuildService/guildservicebasic

    ${PROJECT_SOURCE_DIR}/../thirdparty
    ${PROJECT_SOURCE_DIR}/../thirdparty/rpc-backend-cpp/src
    ${PROJECT_SOURCE_DIR}/../src
    ${PROJECT_SOURCE_DIR}/../package/include
    ${PROJECT_SOURCE_DIR}/../package/include/struct/GuildService/guildservicebasic
)
list(APPEND LINK_LIB "
")
include_directories(${INCLUDE_DIR})

aux_source_directory(. SRC_FILE_LIST)
add_executable (
    ${PROJECT_NAME}
    ${SRC_FILE_LIST}
)
IF (MSVC)
    foreach(var
        CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
        CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
        CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
        CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO
        )
        if(${var} MATCHES "/MD")
            string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}")
        endif()
    endforeach()
  target_link_libraries(${PROJECT_NAME}
      optimized ${PROJECT_SOURCE_DIR}/../lib/root/Release/librpc.a debug ${PROJECT_SOURCE_DIR}/../lib/root/Debug/librpc.a
      optimized ${PROJECT_SOURCE_DIR}/../lib/Windows/Release/libprotobuf.lib debug ${PROJECT_SOURCE_DIR}/../lib/Windows/Debug/libprotobufd.lib
      optimized ${PROJECT_SOURCE_DIR}/../lib/Windows/Release/libknet.a debug ${PROJECT_SOURCE_DIR}/../lib/Windows/Debug/libknet.a
      # optimized ${PROJECT_SOURCE_DIR}/../win-proj/Release/sdk-framework.dll debug ${PROJECT_SOURCE_DIR}/../win-proj/Debug/sdk-framework.dll
      wldap32.lib
      ws2_32.lib
      psapi.lib
  )
ELSE()
  set(CMAKE_CXX_FLAGS "-m64 -g -O0 -std=c++17 -Wall -Wno-unused-variable -fnon-call-exceptions")
  set(CMAKE_CXX_COMPILER "g++")

  target_link_libraries(${PROJECT_NAME}
    #   ${PROJECT_SOURCE_DIR}/../src/build/libsdk-framework.so
      -lpthread
      -ldl
  )
ENDIF()
